package com.chang.order.config;

import com.chang.order.interceptor.LoginUserInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: changzhenxi
 * @date: 2025年01月06日 14:19
 * @Version: 1.0
 * @description:
 */
@Configuration
public class OrderWebConfiguration implements WebMvcConfigurer {

    @Resource
    LoginUserInterceptor loginUserInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 所有请求都要用这个拦截器进行拦截
        registry.addInterceptor(loginUserInterceptor).addPathPatterns("/**");
    }
}
